package com.steel.yfmall.cloud.assistant.impl;

import com.steel.yfmall.cloud.assistant.api.stock.ZgFrameworkContractInfoService;
import com.steel.yfmall.cloud.assistant.dto.zg.ZgCallWsdlAPIBaseDTO;
import com.steel.yfmall.cloud.assistant.utils.zg.ZgCallServiceUtils;
import com.steel.yfmall.cloud.assistant.utils.zg.ZgMethodBeanUtil;
import com.steel.yfmall.cloud.components.utils.base.APIMsgBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 框架合同信息 推送 到中冠 建立框架合同信息
 *
 * @author jia chang bao
 * @date 2020/12/21 21:19
 */
@Service
@Slf4j
public class ZgFrameworkContractInfoServiceImpl implements ZgFrameworkContractInfoService {

    @Value("${jyjt_zgSystem_so_extranet_url}")
    private String ZG_SO_EXTRANET_URL;

    @Value("${jyjt_zgSystem_soWSKEC_url}")
    private String ZG_SO_WSKEC_URL;
    /**
     * 框架合同数据 推送给中冠
     *
     * @param object 数据
     * @return 结果
     * @author jia chang bao
     */
    @Override
    public APIMsgBean<String> sendZgSo(Object object) {
        //填充方法信息
        ZgCallWsdlAPIBaseDTO wsdlUtilBean = new ZgCallWsdlAPIBaseDTO();
        //请求地址
        wsdlUtilBean.setUrl(ZG_SO_EXTRANET_URL);
        //方法名
        wsdlUtilBean.setInterfaceName(ZgMethodBeanUtil.SO05);
        //参数名称
        wsdlUtilBean.setParameterType(ZgMethodBeanUtil.SO_SYSTEM);

        return zgCallServiceUtils.commonCallZgSoApi(object, wsdlUtilBean);
    }

    /**
     * 变更合同信息
     *
     * @param object 数据
     * @return 结果
     * @author jia chang bao
     */
    @Override
    public APIMsgBean<String> sendZgSoChangeContract(Object object) {
        //填充方法信息
        ZgCallWsdlAPIBaseDTO wsdlUtilBean = new ZgCallWsdlAPIBaseDTO();
        //请求地址
        wsdlUtilBean.setUrl(ZG_SO_WSKEC_URL);
        //方法名
        wsdlUtilBean.setInterfaceName(ZgMethodBeanUtil.CREATE_CONTRACT_CHANGE);
        //参数名称
        wsdlUtilBean.setParameterType(ZgMethodBeanUtil.SO_SYSTEM);

        return zgCallServiceUtils.commonCallZgSoApi(object, wsdlUtilBean);
    }

    @Resource
    private ZgCallServiceUtils zgCallServiceUtils;
}
